package com.sunday.aomicaichang.ui.collection;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;

import com.flyco.tablayout.SlidingTabLayout;
import com.sunday.common.adapter.MainFragmentPagerAdapter;
import com.sunday.common.base.BaseActivity;
import com.sunday.aomicaichang.R;

import java.util.ArrayList;

import butterknife.Bind;
import butterknife.ButterKnife;

public class CollectionActivity extends BaseActivity {

    @Bind(R.id.slide_tab)
    SlidingTabLayout slideTab;
    @Bind(R.id.view_pager)
    ViewPager viewPager;

    private ArrayList<Fragment> fragments = new ArrayList<>();
    private final String[] mTitles = {
            "商品", "菜谱", "资讯"
    };
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_collection);
        ButterKnife.bind(this);
        initView();
    }

    private void initView() {
        fragments.add(CollectionFragment.newInstance("1"));
        fragments.add(CollectionFragment.newInstance("2"));
        fragments.add(CollectionFragment.newInstance("3"));
        viewPager.setAdapter(new MainFragmentPagerAdapter(getSupportFragmentManager(), mContext, fragments,
                R.array.buy_order_list_title));
        slideTab.setViewPager(viewPager, mTitles, this, fragments);
        viewPager.setCurrentItem(0,false);
    }
}
